Skip to content

Conversation

@zucchini-nlp
Copy link
Member

@zucchini-nlp zucchini-nlp commented Oct 9, 2025

What does this PR do?

As per title, in v5 we will start saving in the new nested format. The loading is still supported though for old-format configs

Also, we don't need an optional_attributes field that does not do what it is called. Since it is only chat template, let's just manually pop and set it. For audio tokenizers, it'd be nice to refactor a bit, I think we could try to move it in self.attributes

Fixes #40447 by deleting ambiguously named optional_attributes

@zucchini-nlp zucchini-nlp mentioned this pull request Oct 9, 2025
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Let's remove the option to save in legacy format though, it does not really make sense to have it anymore as we want to save with better format starting with v5!

@zucchini-nlp
Copy link
Member Author

zucchini-nlp commented Oct 14, 2025

Done, completely removed all legacy options for saving and in tests. CI is failing for unrelated reasons

Copy link
Member

@Cyrilvallez Cyrilvallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks a lot for removing all the legacy! Very happy to start saving with this new format!

Comment on lines -835 to +817
output_chat_template_file_legacy = os.path.join(
save_directory, LEGACY_PROCESSOR_CHAT_TEMPLATE_FILE
) # Legacy filename
output_chat_template_file_legacy = os.path.join(save_directory, LEGACY_PROCESSOR_CHAT_TEMPLATE_FILE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this one as well? I see we already save the jinja one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for @Rocketknight1 to decide if we can delete that totally. I think we're converging to one format for templates, though not sure when the legacy can be deleted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think legacy saving can be dropped in v5 but legacy loading needs to stay, because a lot of checkpoints are still in the old format

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: align, auto, chinese_clip, clipseg, flava, granite_speech, layoutlmv2, layoutlmv3, markuplm, mgp_str, oneformer, owlvit, speech_to_text, speecht5, vision_text_dual_encoder, wav2vec2

@zucchini-nlp zucchini-nlp merged commit 7b7d17f into huggingface:main Oct 16, 2025
22 checks passed
ngazagna-qc pushed a commit to ngazagna-qc/transformers that referenced this pull request Oct 23, 2025
* toggle the serialization

* prob this fixes it

* fix tests

* typo

* delete legacy save entirely

* remove extra nesting in if

* revert test and serialzie a public attr instead of private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Processor does not load optional attributes

4 participants